"""
@file:   base
@author: FrankYi
@date:   2020/08/13
@desc:
"""
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import MetaData

naming_convention = {
    "ix": 'ix_%(column_0_label)s',
    "uq": "uq_%(table_name)s_%(column_0_name)s",
    "ck": "ck_%(table_name)s_%(column_0_name)s",
    "fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
    "pk": "pk_%(table_name)s"
}

# 解决sqlite作为后端 => “ValueError: Constraint must have a name"的问题
db = SQLAlchemy(metadata=MetaData(naming_convention=naming_convention))
from . import user
from . import comment
from . import content